package com.wondersgroup.fjzlpt.org.dao.impl.zdgl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.repository.sql.bean.page.PageQuerySQLBean;
import com.quick.framework.boot.repository.sql.bean.table.TableBean;
import com.quick.framework.boot.repository.sql.jdbcTemplate.impl.BaseJTDAOImpl;
import com.quick.framework.boot.repository.sql.jdbcTemplate.rs.ResultHandlerConstant;
import com.wondersgroup.fjzlpt.org.dao.inter.zdgl.ZdglDAO;
@Repository
public class ZdglDAOImpl extends BaseJTDAOImpl implements ZdglDAO{
	@Override
	@Autowired
	@Qualifier("TB_ZY_CATALOG")
	public void setTb(TableBean tb) {
		super.setTb(tb);
	}

	/**
	 * 分页查询
	 */
	public JSONObject queryPage(Map<String, String> map) {
		StringBuilder sbud = new StringBuilder("select * from TB_ZY_CATALOG WHERE 1=1 \n");
		List list = new ArrayList();
		String value = map.get("ZDMC");
		if(!StringUtils.isEmpty(value))
		{
			sbud.append("and ZDMC like ? ");
			list.add("%"+value+"%");
		}
		PageQuerySQLBean sb = super.checkAndCreatePageQuerySQLBean(map, sbud.toString(), "order by ZDBM ", list.toArray());
		return super.queryPage(sb, ResultHandlerConstant.JSONARRAY);
	}
	
}
